package com.xy.biz.fd.domain.converter;


import java.util.Collection;
import java.util.List;
import com.xy.biz.fd.domain.po.DocumentRubbishPO;
import com.xy.biz.fd.domain.query.DocumentRubbishQuery;
import com.xy.biz.fd.domain.req.rubbish.SaveDocumentRubbishRequest;
import com.xy.biz.fd.domain.req.rubbish.ListDocumentRubbishRequest;
import com.xy.biz.fd.domain.bo.DocumentRubbishBO;
import com.xy.biz.fd.domain.resp.GetDocumentRubbishResponse;
import com.xy.tool.util.BeanUtilsEx;

/**
 * 
 * 
 * @author yzh
 * @date 2021年1月30日
 */
public class DocumentRubbishConverter {
	
	public static DocumentRubbishPO toPO(DocumentRubbishBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new DocumentRubbishPO(), true);
	}
	
	public static List<DocumentRubbishPO> toPO(Collection<DocumentRubbishBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new DocumentRubbishPO(), true);
	}
	
	public static DocumentRubbishBO fromPO(DocumentRubbishPO source) {
		return BeanUtilsEx.copyProperties(source, () -> new DocumentRubbishBO());
	}
	
	public static List<DocumentRubbishBO> fromPO(Collection<DocumentRubbishPO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new DocumentRubbishBO());
	}
	
	public static DocumentRubbishBO toBO(SaveDocumentRubbishRequest source) {
		return BeanUtilsEx.copyProperties(source, () -> new DocumentRubbishBO(), true);
	}
	
	public static List<DocumentRubbishBO> toBO(Collection<SaveDocumentRubbishRequest> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new DocumentRubbishBO(), true);
	}
	
	public static GetDocumentRubbishResponse toResponse(DocumentRubbishBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new GetDocumentRubbishResponse());
	}
	
	public static List<GetDocumentRubbishResponse> toResponse(Collection<DocumentRubbishBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new GetDocumentRubbishResponse());
	}
	
	public static DocumentRubbishQuery toQuery(ListDocumentRubbishRequest source) {
		if(null == source) {
			return null;
		}
		DocumentRubbishQuery target = new DocumentRubbishQuery(source.getPageIndex(), source.getPageSize());
		BeanUtilsEx.copyProperties(source, target);
		return target;
	}

}
